﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Kinect;

namespace ISMOT.HCI.KGL
{
    public class Pose : ITolerable
    {
        public Pose()
        {
            this.JointPositions = new JointPositionCollection();
            this.Tolerance = 100;
        }

        public int Tolerance { get; set; }
        public JointPositionCollection JointPositions { get; set; }

        public virtual bool IsHit(Skeleton body)
        {
            bool allHit = true;
            foreach (var jp in this.JointPositions)
            {
                var distance = body.Joints[jp.Joint].Position.ToMillimeters().Distance(jp.Position);
                if (distance > this.Tolerance)
                {
                    allHit = false;
                    break;
                }
            }
            return (allHit);
        }
    }
}
